<!DOCTYPE html>
<html>

<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta charset="utf-8" />
<title>圣仙美业</title>
<link rel="shortcut icon" href="assets/images/logosmall.png">
<link rel="stylesheet" href="assets/libs/layui/css/layui.css" />
<link rel="stylesheet" href="assets/css/login.css" media="all">
<script>
	if (window != top)
		top.location.replace(location.href);
</script>
</head>

<body>
	<div class="login-wrapper">
		<div class=" login-body">
			<div class="login-header" style="text-align: center;">
				<!-- <img src="assets/images/logobig.png"> -->
				<img src="assets/images/name.png">
				<p>值得您终身信赖的品牌</p>
			</div>
			<div class="layui-card">
				<div class="layui-card-header">
					<i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;用户登录
				</div>
				<form class="layui-card-body layui-form layui-form-pane">
					<div class="layui-form-item">
						<label class="layui-form-label"><i
							class="layui-icon layui-icon-username"></i></label>
						<div class="layui-input-block">
							<input name="username" type="text" lay-verify="required"
								placeholder="帐号" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><i
							class="layui-icon layui-icon-password"></i></label>
						<div class="layui-input-block">
							<input name="password" type="password" lay-verify="required"
								placeholder="密码" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><i
							class="layui-icon layui-icon-vercode"></i></label>
						<div class="layui-input-block">
							<div class="layui-row inline-block">
								<div class="layui-col-xs7">
									<input name="code" type="text" lay-verify="required"
										placeholder="验证码" class="layui-input">
								</div>
								<div class="layui-col-xs5" style="padding-left: 10px;">
									<img class="login-captcha" src="${ctxPath }/assets/captcha">
								</div>
							</div>
						</div>
					</div>
					<div class="layui-form-item">
						<button lay-filter="login-submit"
							class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
					</div>
				</form>
			</div>
		</div>

		<div class="login-footer">
			<p>
				© 2019 <a href="javascript:;">圣仙美业版权所有</a>
			</p>
			<p>
				<span><a href="http://www.shengxianmeiye.com" target="_blank">前往官网</a></span>
			</p>
		</div>
	</div>

	<script type="text/javascript" src="assets/libs/layui/layui.js"></script>
	<script>
		layui.config({
			base : 'module/'
		}).use([ 'form' ], function() {
			var $ = layui.jquery;
			var form = layui.form;

			// 表单提交
			form.on('submit(login-submit)', function(obj) {
				layer.load(2);
				$.post('login', obj.field, function(data) {
					if (200 == data.code) {
						layer.msg('登录成功', {
							icon : 1,
							time : 1500
						}, function() {
							location.replace('./');
						});
					} else {
						layer.closeAll('loading');
						layer.msg(data.msg, {
							icon : 5
						});
						$('.login-captcha').trigger('click');
					}
				}, 'JSON');
				return false;
			});

			// 图形验证码
			$('.login-captcha').click(function() {
				this.src = this.src + '?t=' + (new Date).getTime();
			});
		});
	</script>
</body>
</html>